#!/usr/bin/env bash

cp -r /data/config.py /data/FlowAI5/code/tools/
chmod 777 -R /data/FlowAI5/
NAME='/data/FlowAI5/FlowShell/uwsgi'
ID=`ps -ef | grep "${NAME}" |  grep -v "grep" | awk '{print $2}'`
for id in ${ID}
do
kill -9 ${id}
done
sleep 5
uwsgi --ini /data/FlowAI5/FlowShell/uwsgi.ini

if [ $? == 0 ];then
        echo "项目启动成功。。。"
else
        echo "项目未启动，需验证，并启动nginx。。。"
        exit 0
fi
/usr/local/nginx/sbin/nginx
lsof -i:80
cd /data/FlowAI5/code/FlowServer/
python ValidateService.py  #测试连通性
timeout 5s tailf /data/FlowAI5/FlowShell/uwsgi.log